<template>
	<view class="conter">
		
		
		
		<view class="header" style="color: #000000;" @tap="goBack('/pages/tab/index')">
			<view class="arrow">
			</view>
			<view class="title">
				{{title}}
			</view>
		</view>
		
		
		
		
		<view class="text-tab">

			<view class="box">
				<view class="marg-cent" >
					<view class="f-1 flex justify-center" style="font-weight: 700;">
						盘点日期
					</view>
					<view class="f-1 flex justify-center" style="font-weight: 700;">
						仓库
					</view>
					<view class="f-1 flex justify-center" style="font-weight: 700;">
						盈亏情况
					</view>
				</view>
			</view>
			
			
			<view class="" style="width: 100%; background-color: #FFFFFF;">
				<view class="box-border" v-for="(item, index) in textList" :key="index">
					<view class="marg-box">
						<view class="f-1 flex justify-center" style="white-space: nowrap;">
							{{item.createtime}}
						</view>
						<view class="f-1 flex justify-center">
							{{item.store_name}}
						</view>
						<view class="f-1 flex justify-center" style="color: #7278EC;" @click="goStockInfo(item.store_id,item.store_name,item.createtime, item.check_order)">
							查看>>
						</view>
					</view>
				</view>
			</view>
		</view>


		<navigator url="/pages/stock/stockList" class="add">
			<image class="w100 h100" src="../../static/index/add.png" mode=""></image>
		</navigator>




		<!-- 顶部弹层 -->
		<u-popup v-model="redactShow" mode="top" width="100%" border-radius="40">


			<!-- 公共头部 -->
			<header-box :title="title"></header-box>
			<view style="padding: 13rpx 23rpx;
				font-family: PingFang SC;
				background-color: #EBEBF0;
				color: #333333; width: 140rpx;
				font-size: 24rpx; margin: 30rpx;" @click="redactShow = true">创建日期</view>
			<view class="text-fw" style="margin-left: 30rpx; margin-bottom: 30rpx;">
				搜索创建日期
			</view>
			
			<view class="box1">
				<view class="box-bgc" @click="show = true">
					{{statckTime ? statckTime : '开始时间'}}
				</view>
				-
				<view class="box-bgc" @click="show1 = true">
					{{endTime ? endTime : '结束日期'}}
				</view>
			</view>
			<view class="search-box bg-gradual-green" @tap="search">
				搜索
			</view>
		</u-popup>


		<!-- 日历 -->
		<u-calendar v-model="show" :mode="mode" @change="change"></u-calendar>
		<u-calendar v-model="show1" :mode="mode" @change="change1"></u-calendar>





		<u-popup v-model="popupShow" mode="center" width="70%" height="280rpx" border-radius="10">
			<view class="input-text">
				商品分类
			</view>
			<view class="input-val">
				<input type="text" value="" style="background-color: #F0F0F0; text-align: center;"
					placeholder="请输入商品类目" />
			</view>
			<view class="text-select">
				<view class="" @click="popupShow = false">
					取消
				</view>
				<view class="">
					确定
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import headerBox from '../../components/header/header.vue'

	export default {
		components: {
			headerBox
		},
		data() {
			return {
				title: '盘点详情',
				textList: [],
				addUrl: '',
				redactShow: false,
				list: [{
					name: '编辑',
					show: true
				}, {
					name: '删除',
					show: true
				}, {
					name: '取消',
					show: false
				}],
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				tabText: 0,
				popupShow: false,
				show: false,
				show1: false,
				mode: 'date',
				statckTime: '',
				endTime: '',
				page: 1,
				rows: 20,
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.textList = []
			this.getList()
		},
		onReachBottom() {
			this.page++
			this.getList()
		},
		methods: {
			
			goBack(url) {
				// uni.navigateBack({
				// 	delta: 1
				// })
				
				uni.navigateTo({
					url,
				})
			
			},

			async getList() {
				const res = await this.$u.post("api/Invoic/check_find",{
					page: this.page,
					pagesize: this.rows,
				});
				this.textList = [...this.textList,...res.data]
				console.log('0000', res)
			},

			goStockInfo(id,name,time,check_order) {
				console.log(time)
				uni.navigateTo({
					url: '/pages/stock/stockInfo?shtockId=' + id + '&name=' + name + '&time=' + time + '&check_order=' + check_order
				})
			},

			elect(item, index) {
				console.log(index)
				this.tabText = index
				this.redactShow = item.show
				if (index == 0) {
					uni.navigateTo({
						url: '/pages/shopping/compile'
					})
					// 跳转到编辑页面
					// this.redactShow = true
				} else if (index == 1) {
					// 调用删除事件
				}
			},


			change(e) {
				this.statckTime = e.result
				console.log(e.result);
			},

			change1(e) {
				this.endTime = e.result
				console.log(e);
			},
			
			async search() {
				const res = await this.$u.post("api/jinxiao.check/index",{
					starttime: this.statckTime,
					endtime: this.endTime,
				});
				this.textList = res.data.list
				if(res.code != 1) return this.$tools.msg('搜索失败')
				this.$tools.msg(res.msg)
				this.redactShow = false
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.conter {
		width: 100%;
		height: 100vh;
		font-size: 24rpx;
		position: relative;
		background-color: #EEEEEE;

		// image {
		// 	width: 100%;
		// 	height: 100%;
		// }
		
		.header {
			width: 100%;
			height: 150rpx;
			line-height: 150rpx;
			display: flex;
			align-items: center;
			// padding-left: 10rpx;
			padding-top: 30rpx;
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			background: linear-gradient(to right, #656CE6, #9397FC);
		
			.arrow {
				position: relative;
				display: inline-block;
			}
		
			.arrow::before {
				content: '';
				width: 10px;
				height: 10px;
				border: 0px;
				border-bottom: solid 2px #fff;
				border-left: solid 2px #fff;
				-ms-transform: rotate(45deg);
				-webkit-transform: rotate(45deg);
				transform: rotate(45deg);
				position: absolute;
				top: 50%;
				left: 0;
				margin-top: -4px;
				margin-left: 28rpx;
			}
		
			.title {
				color: #fff;
				margin: 0 auto;
			}
		}

		.text-tab {
			width: 100%;
			padding: 30rpx;
			padding-bottom: 0;
			// background-color: #FFFFFF;

			.box {
				width: 100%;
				height: 75rpx;
				line-height: 75rpx;
				color: #666666;
				background-color: #FFFFFF;
				border-radius: 10rpx;
			}

			.marg-box {
				width: 100%;
				height: 75rpx;
				line-height: 75rpx;
				display: flex;
				margin: 0 auto;
				text-align: center;
				text-align: center;
				justify-content: space-around;
			}

			.marg-cent {
				width: 90%;
				height: 75rpx;
				line-height: 75rpx;
				display: flex;
				margin: 0 auto;
				color: #666;
				text-align: center;
				text-align: center;
				justify-content: space-around;
			}

			// .marg-box:last-child {
			// 	border-bottom: 0;
			// }

			.box-border {
				width: 90%;
				height: 75rpx;
				line-height: 75rpx;
				color: #333333;
				margin: 0 auto;
				background-color: #FFFFFF;
				border-radius: 10rpx;
				border-top: 1rpx solid #F0F0F0;
			}

			.box-width {
				width: 90%;
			}

			.marige-bor {
				width: 100%;
				margin: 0 auto;
				color: #333333;
				display: flex;
				font-size: 28rpx;
				align-items: center;
				background-color: #FFFFFF;
				border-top: 1rpx solid #F0F0F0;
				justify-content: space-between;

				.diso-flex {
					width: 90%;
					height: 80rpx;
					display: flex;
					align-items: center;
					justify-content: space-around;
				}

				.conter-image {
					width: 22rpx;
					height: 36rpx;
					font-weight: 700;
					color: #999;
				}
			}

			.marige-bor:last-child {
				border-bottom: 0;
			}
		}

		// 加号
		.add {
			position: fixed;
			bottom: 200rpx;
			right: 40rpx;
			width: 100rpx;
			height: 100rpx;
			text-align: center;
			line-height: 100rpx;
			border-radius: 50%;
			font-size: 100rpx;
			color: #FFFFFF;
		}

		.total {
			width: 100%;
			position: absolute;
			bottom: 0;
			left: 0;
			height: 100rpx;
			padding: 0 60rpx 0 30rpx;
			background-color: #FFFFFF;
		}

	}

	.padd-text {
		width: 80%;
		height: 106rpx;
		line-height: 106rpx;
		text-align: center;
		font-size: 28rpx;
		color: #333;
		border-bottom: 1rpx solid #EEEEEE;
		margin: 0 auto;
	}

	.color-text {
		color: #7278EC;
	}

	.none-color {
		color: #000;
	}

	.input-text {
		width: 100%;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		margin-top: 10rpx;
	}

	.input-val {
		width: 80%;
		height: 78rpx;
		margin: 0 auto;
	}

	.text-select {
		width: 90%;
		margin: 0 auto;
		border-top: 1rpx solid #F0F0F0;
		display: flex;
		// padding-top: 20rpx;
		justify-content: space-around;

		view {
			width: 50%;
			height: 80rpx;
			line-height: 80rpx;
			text-align: center;
			border-right: 1rpx solid #F0F0F0;
		}

		view:last-child {
			border-right: 0;
		}
	}

	.flex-box1 {
		display: flex;
		margin: 0 30rpx;
		justify-content: space-around;
	}


	.flex-box2 {
		margin: 0 30rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;

		view {
			line-height: 50rpx;
		}
	}

	.box1 {
		display: flex;
		align-items: center;
		justify-content: space-around;
		margin: 0 30rpx;

		.box-bgc {
			width: 330rpx;
			height: 60rpx;
			text-align: center;
			line-height: 60rpx;
			border-radius: 6rpx;
			background-color: #F2F3F7;
		}
	}

	.search-box {
		width: 90%;
		height: 70rpx;
		line-height: 70rpx;
		font-size: 28rpx;
		border-radius: 35rpx;
		margin: 20rpx auto;
		text-align: center;
	}
</style>
